home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / selectionMaskStackInit.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  9.0 KB  |  290 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. // Alias|Wavefront Script File
  19. // MODIFY THIS AT YOUR OWN RISK
  20. //
  21. // Creation Date:  1 December 1996
  22. // Author:         ms
  23. //
  24. //
  25. //  Procedure Name:
  26. //        selectionMaskStack
  27. //
  28. //  Description:
  29. //        The selection mask stack initialization
  30. //
  31. //  Input Arguments:
  32. //      None.
  33. //
  34. //  Return Value:
  35. //      None.
  36. //
  37.  
  38. proc string captureSelectionMaskAndPrefs()
  39. {
  40.     string $command;
  41.  
  42.     // The highlight info:
  43.     $command = ("selectPref -allowHiliteSelection " +
  44.                 `selectPref -q -allowHiliteSelection` + 
  45.  
  46.                 // Affects active:
  47.                 " -affectsActive " +
  48.                 `selectPref -q -affectsActive` +
  49.  
  50.                 // Ignore/Respect selection priorities
  51.                 " -ignoreSelectionPriority " +
  52.                 `selectPref -q -ignoreSelectionPriority` + "; "
  53.                );
  54.  
  55.     // The select type:
  56.     $command = ( $command + "selectType"
  57.  
  58.     // object selection masks
  59.     
  60.         +" -handle " + `selectType -q -handle` 
  61.         +" -ikHandle " + `selectType -q -ikHandle` 
  62.     
  63.         +" -joint " + `selectType -q -joint` 
  64.     
  65.         +" -nurbsCurve " + `selectType -q -nurbsCurve` 
  66.         +" -cos " + `selectType -q -cos` 
  67.  
  68.         +" -nurbsSurface " + `selectType -q -nurbsSurface` 
  69.         +" -polymesh " + `selectType -q -polymesh` 
  70.         +" -subdiv " + `selectType -q -subdiv` 
  71.         +" -plane " + `selectType -q -plane` 
  72.         +" -stroke " + `selectType -q -stroke` 
  73.     
  74.         +" -lattice " + `selectType -q -lattice` 
  75.         +" -cluster " + `selectType -q -cluster`
  76.         +" -sculpt " + `selectType -q -sculpt`
  77.         +" -nonlinear " + `selectType -q -nonlinear`                 
  78.     
  79.         +" -particleShape " + `selectType -q -particleShape` 
  80.         +" -emitter " + `selectType -q -emitter` 
  81.         +" -field " + `selectType -q -field` 
  82.         +" -fluid " + `selectType -q -fluid` 
  83.         +" -spring " + `selectType -q -spring` 
  84.         +" -rigidBody " + `selectType -q -rigidBody`
  85.         +" -rigidConstraint " + `selectType -q -rigidConstraint` 
  86.         +" -collisionModel " + `selectType -q -collisionModel` 
  87.     
  88.         +" -light " + `selectType -q -light`
  89.         +" -camera " + `selectType -q -camera` 
  90.         +" -texture " + `selectType -q -texture` 
  91.     
  92.         +" -ikEndEffector " + `selectType -q -ikEndEffector` 
  93.         +" -locator " + `selectType -q -locator`
  94.         +" -dimension " + `selectType -q -dimension` 
  95.  
  96.     // component selection masks
  97.  
  98.         +" -cv " + `selectType -q -cv`
  99.         +" -vertex " + `selectType -q -vertex`
  100.         +" -subdivMeshPoint " + `selectType -q -subdivMeshPoint`
  101.         +" -latticePoint " + `selectType -q -latticePoint`
  102.         +" -particle " + `selectType -q -particle`
  103.         
  104.         +" -editPoint " + `selectType -q -editPoint`
  105.         +" -curveParameterPoint " + `selectType -q -curveParameterPoint`
  106.         +" -surfaceParameterPoint " + `selectType -q -surfaceParameterPoint`
  107.         +" -polymeshUV " + `selectType -q -polymeshUV`
  108.  
  109.         +" -polymeshEdge " + `selectType -q -polymeshEdge`
  110.         +" -subdivMeshEdge " + `selectType -q -subdivMeshEdge`
  111.         +" -isoparm " + `selectType -q -isoparm`
  112.         +" -surfaceEdge " + `selectType -q -surfaceEdge`
  113.         +" -surfaceFace " + `selectType -q -surfaceFace`
  114.         +" -springComponent " + `selectType -q -springComponent`
  115.         
  116.         +" -facet " + `selectType -q -facet`
  117.         +" -subdivMeshFace " + `selectType -q -subdivMeshFace`
  118.         
  119.         +" -hull " + `selectType -q -hull`
  120.         
  121.         +" -rotatePivot " + `selectType -q -rotatePivot`
  122.         +" -scalePivot " + `selectType -q -scalePivot`
  123.         +" -jointPivot " + `selectType -q -jointPivot`
  124.         
  125.         +" -selectHandle " + `selectType -q -selectHandle`
  126.         
  127.         +" -localRotationAxis " + `selectType -q -localRotationAxis`
  128.         +" -imagePlane " + `selectType -q -imagePlane`
  129.         +"; "
  130.     );
  131.  
  132.     // The select priority:
  133.     $command = ( $command + "selectPriority"
  134.  
  135.     // object selection masks
  136.  
  137.         +" -handle " + `selectPriority -q -handle` 
  138.         +" -ikHandle " + `selectPriority -q -ikHandle` 
  139.     
  140.         +" -joint " + `selectPriority -q -joint` 
  141.     
  142.         +" -nurbsCurve " + `selectPriority -q -nurbsCurve` 
  143.         +" -cos " + `selectPriority -q -cos` 
  144.  
  145.         +" -nurbsSurface " + `selectPriority -q -nurbsSurface` 
  146.         +" -polymesh " + `selectPriority -q -polymesh` 
  147.         +" -subdiv " + `selectPriority -q -subdiv` 
  148.         +" -plane " + `selectPriority -q -plane` 
  149.         +" -stroke " + `selectPriority -q -stroke` 
  150.     
  151.         +" -lattice " + `selectPriority -q -lattice` 
  152.         +" -cluster " + `selectPriority -q -cluster`
  153.         +" -sculpt " + `selectPriority -q -sculpt`
  154.         +" -nonlinear " + `selectPriority -q -nonlinear`
  155.     
  156.         +" -particleShape " + `selectPriority -q -particleShape` 
  157.         +" -emitter " + `selectPriority -q -emitter` 
  158.         +" -field " + `selectPriority -q -field` 
  159.         +" -fluid " + `selectPriority -q -fluid` 
  160.         +" -spring " + `selectPriority -q -spring` 
  161.         +" -rigidBody " + `selectPriority -q -rigidBody`
  162.         +" -rigidConstraint " + `selectPriority -q -rigidConstraint` 
  163.         +" -collisionModel " + `selectPriority -q -collisionModel` 
  164.     
  165.         +" -light " + `selectPriority -q -light`
  166.         +" -camera " + `selectPriority -q -camera` 
  167.         +" -texture " + `selectPriority -q -texture` 
  168.     
  169.         +" -ikEndEffector " + `selectPriority -q -ikEndEffector` 
  170.         +" -locator " + `selectPriority -q -locator`
  171.         +" -dimension " + `selectPriority -q -dimension` 
  172.  
  173.     // component selection masks
  174.  
  175.         +" -cv " + `selectPriority -q -cv` 
  176.         +" -vertex " + `selectPriority -q -vertex` 
  177.         +" -subdivMeshPoint " + `selectPriority -q -subdivMeshPoint` 
  178.         +" -latticePoint " + `selectPriority -q -latticePoint` 
  179.         +" -particle " + `selectPriority -q -particle` 
  180.         
  181.         +" -editPoint " + `selectPriority -q -editPoint`
  182.         +" -curveParameterPoint " + `selectPriority -q -curveParameterPoint` 
  183.         +" -surfaceParameterPoint " + `selectPriority -q -surfaceParameterPoint`         +" -polymeshUV " + `selectPriority -q -polymeshUV`
  184.  
  185.         +" -polymeshEdge " + `selectPriority -q -polymeshEdge` 
  186.         +" -subdivMeshEdge " + `selectPriority -q -subdivMeshEdge`
  187.         +" -isoparm " + `selectPriority -q -isoparm` 
  188.         +" -surfaceEdge " + `selectPriority -q -surfaceEdge` 
  189.         +" -surfaceFace " + `selectPriority -q -surfaceFace` 
  190.         +" -springComponent " + `selectPriority -q -springComponent` 
  191.         
  192.         +" -facet " + `selectPriority -q -facet` 
  193.         +" -subdivMeshFace " + `selectPriority -q -subdivMeshFace` 
  194.         
  195.         +" -hull " + `selectPriority -q -hull`
  196.         
  197.         +" -rotatePivot " + `selectPriority -q -rotatePivot` 
  198.         +" -scalePivot " + `selectPriority -q -scalePivot` 
  199.         +" -jointPivot " + `selectPriority -q -jointPivot` 
  200.         
  201.         +" -selectHandle " + `selectPriority -q -selectHandle` 
  202.         
  203.         +" -localRotationAxis " + `selectPriority -q -localRotationAxis`
  204.         +" -imagePlane " + `selectPriority -q -imagePlane`
  205.         +"; "
  206.     );
  207.  
  208.     return $command;
  209. }
  210.  
  211.  
  212. global proc string currentSelectionMask()
  213. {
  214.     string $command = `captureSelectionMaskAndPrefs`;
  215.     
  216.     // The selectMode:
  217.     if( `selectMode -q -root` ) {
  218.         $command = $command + "selectMode -root; ";
  219.     }
  220.     if( `selectMode -q -leaf` ) {
  221.         $command = $command + "selectMode -leaf; ";
  222.     }
  223.     if( `selectMode -q -template` ) {
  224.         $command = $command + "selectMode -template; ";
  225.     }
  226.     if( `selectMode -q -object` ) {
  227.         $command = $command + "selectMode -object; ";
  228.     }
  229.     if( `selectMode -q -preset` ) {
  230.         $command = $command + "selectMode -preset; ";
  231.     }
  232.     if( `selectMode -q -component` ) {
  233.         $command = $command + "selectMode -component; ";
  234.     }
  235.     if( `selectMode -q -hierarchical` ) {
  236.         $command = $command + "selectMode -hierarchical; ";
  237.     }
  238.  
  239.     return $command;
  240. }
  241.  
  242.  
  243. global proc selectionMaskReset()
  244. //
  245. //    Reset the selection masks to the state they were on startup
  246. //
  247. {
  248.     global string $gSelectionMaskInitial;
  249.     eval( $gSelectionMaskInitial );
  250. }
  251.  
  252.  
  253. global proc selectionMaskResetAll()
  254. //
  255. //    Reset the selection masks and the selection mode
  256. //    to the state they were on startup.
  257. //
  258. {
  259.     selectionMaskReset();
  260.     selectMode -object;
  261. }
  262.  
  263. global proc selectionMaskSaveOnce()
  264. {
  265.     global string $gSelectionMaskStack;
  266.     if( "" == $gSelectionMaskStack ) {
  267.         $gSelectionMaskStack = `currentSelectionMask`;
  268.     }
  269. }
  270.  
  271. global proc selectionMaskRestoreOnce()
  272. {
  273.     global string $gSelectionMaskStack;
  274.     if( "" != $gSelectionMaskStack ) {
  275.         eval( $gSelectionMaskStack );
  276.         $gSelectionMaskStack = "";
  277.     }
  278. }
  279.  
  280. {
  281.     global string $gSelectionMaskStack;
  282.     global string $gSelectionMaskInitial;
  283.  
  284.     $gSelectionMaskInitial = `captureSelectionMaskAndPrefs`;
  285.     $gSelectionMaskStack = "";
  286.  
  287.     scriptJob -permanent -event "NewSceneOpened" "selectionMaskResetAll";
  288.     scriptJob -permanent -event "SceneOpened" "selectionMaskResetAll";
  289. }
  290.